from django.shortcuts import render

# Create your views here.
import json

from django.shortcuts import render
from django.views import View
# Create your views here.
from apps.users.models import User
from django.http import JsonResponse, HttpResponse
from apps.areas.models import Area
class AreaView(View):
    def get(self,request):
        provinces=Area.objects.filter(parent=None)
        province_list =[]
        for province in provinces:
            province_list.append({
                'id':province.id,
                'name':province.name
            })
        return JsonResponse({'code':0,'errmsg':'ok','province_list':province_list})